package com.yjt.gcss.gddw.common.bean.domain;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.yjt.common.tools.TimeUtil;


/**
 * UiPlds entity. @author MyEclipse Persistence Tools
 */
public class UiPlds extends AbstractUiPlds implements java.io.Serializable {

	public static final String BEAN_PACKAGE_NAME = "com.yjt.gcss.gddw.common.bean.domain.UiPlds";
	protected final Log logger = LogFactory.getLog(UiPlds.class);
	/**序号 - 10*/
	public static final int XH_LENGTH = 10;
	/**缴费号 - 20*/
	public static final int JFH_LENGTH = 20;
	/**结算户名称 - 64*/
	public static final int JSHMC_LENGTH = 64;
	/**扣款银行代码 - 4*/
	public static final int KKYHDM_LENGTH = 4;
	/**扣款账户 - 32*/
	public static final int KKZH_LENGTH = 32;
	/**扣款账户名称 - 128*/
	public static final int KKZHMC_LENGTH = 128;
	/**部分缴费标识 - 1*/
	public static final int BFJFBZ_LENGTH = 1;
	/**账务流水号 - 16*/
	public static final int ZWLSH_LENGTH = 16;
	/**电费年月 - 6*/
	public static final int DFNY_LENGTH = 6;
	/**本金 - 16*/
	public static final int BJ_LENGTH = 16;
	/**应扣金额 - 16*/
	public static final int YKJE_LENGTH = 16;
	/**违约金 -16*/
	public static final int WYJ_LENGTH = 16;
	/**扣款结果代码 - 2*/
	public static final int KKJGDM_LENGTH = 2;
	/**实扣金额 - 16*/
	public static final int SKJE_LENGTH = 16;
	/**
	 * notice:电网接口修改此字段长度改为27。updated by lizb(2014-10-29)
	 * 银行收费流水号 - 27
	 * */
	public static final int YHSFLSH_LENGTH = 27;
	/**扣款日期 - 8*/
	public static final int KKRQ_LENGTH = 8;
	/**扣款时间 - 6*/
	public static final int KKSJ_LENGTH = 6;
	/**备注 - 128*/
	public static final int BZ_LENGTH = 128;
	private String query_start_date_createDate;
	private String query_end_date_createDate;
	private String createDateTimeDesc;
	public String getCreateDateTimeDesc() {
		if(TimeUtil.checkDate(this.getCreateDate() + this.getCreateTime(), "yyyyMMddHHmmss")) {
			return TimeUtil.changeStrTimeFormat(this.getCreateDate() + this.getCreateTime(), "yyyyMMddHHmmss", "yyyy-MM-dd HH:mm:ss");
		}
		return "";
	}
	public String getQuery_end_date_createDate() {
		return query_end_date_createDate;
	}
	public void setQuery_end_date_createDate(String query_end_date_createDate) {
		this.query_end_date_createDate = query_end_date_createDate;
	}
	public String getQuery_start_date_createDate() {
		return query_start_date_createDate;
	}
	public void setQuery_start_date_createDate(String query_start_date_createDate) {
		this.query_start_date_createDate = query_start_date_createDate;
	}

	/*
	 * 批量代收的扣款结果代码无法维护到 BT_ORG_RET_CD_MAPPING 中，只能load到内存中。
	 * created by lizb on 2015-3-11
	 * 
	 * */
	/*begin:批量代扣:扣款结果代码*/
	/*<代收付返回码, 扣款结果代码>*/
	private static final Map<String, String> ORG_RET_CD_MAPPING = new HashMap<>();
	/*<扣款结果代码, 扣款结果代码说明>*/
	private static final Map<String, String> ORG_RET_CD_REMARK_MAPPING = new HashMap<>();
	
	static {
		//代收付返回码映射扣款代码
		ORG_RET_CD_MAPPING.put("01","01");
		ORG_RET_CD_MAPPING.put("07","07");
		ORG_RET_CD_MAPPING.put("12","12");
		ORG_RET_CD_MAPPING.put("13","13");
		ORG_RET_CD_MAPPING.put("14","14");
		ORG_RET_CD_MAPPING.put("16","16");
		ORG_RET_CD_MAPPING.put("17","17");
		ORG_RET_CD_MAPPING.put("18","18");
		ORG_RET_CD_MAPPING.put("CG0O1018","15");
		ORG_RET_CD_MAPPING.put("CG0O1046","15");
		ORG_RET_CD_MAPPING.put("CG0O2003","22");
		ORG_RET_CD_MAPPING.put("CG0O9001","99");
		ORG_RET_CD_MAPPING.put("CP0I1000","00");
		ORG_RET_CD_MAPPING.put("CP0O9001","99");
		ORG_RET_CD_MAPPING.put("CP1I1000","00");
		ORG_RET_CD_MAPPING.put("CP1O2999","99");
		ORG_RET_CD_MAPPING.put("CP1O9001","99");
		ORG_RET_CD_MAPPING.put("CP2I1000","00");
		ORG_RET_CD_MAPPING.put("CT0I1000","00");
		ORG_RET_CD_MAPPING.put("CT0O1011","15");
		ORG_RET_CD_MAPPING.put("CT0O6039","06");
		ORG_RET_CD_MAPPING.put("CT1I1000","00");
		ORG_RET_CD_MAPPING.put("CT1O2008","02");
		ORG_RET_CD_MAPPING.put("CT1O2009","03");
		ORG_RET_CD_MAPPING.put("CT1O2017","05");
		ORG_RET_CD_MAPPING.put("CT1O2020","19");
		ORG_RET_CD_MAPPING.put("CT1O2024","20");
		ORG_RET_CD_MAPPING.put("CT1O2039","04");
		ORG_RET_CD_MAPPING.put("CT1O2042","21");
		ORG_RET_CD_MAPPING.put("CT1O2045","22");
		ORG_RET_CD_MAPPING.put("CT1O2057","05");
		ORG_RET_CD_MAPPING.put("CT2I1000","00");
		
		//扣款代码 映射 扣款代码说明
		ORG_RET_CD_REMARK_MAPPING.put("00","已全额扣成功");
		ORG_RET_CD_REMARK_MAPPING.put("01","已部分扣款");
		ORG_RET_CD_REMARK_MAPPING.put("02","余额不足");
		ORG_RET_CD_REMARK_MAPPING.put("03","账户不符");
		ORG_RET_CD_REMARK_MAPPING.put("04","账户已销");
		ORG_RET_CD_REMARK_MAPPING.put("05","坏账户及其他");
		ORG_RET_CD_REMARK_MAPPING.put("06","超出交易金额限制");
		ORG_RET_CD_REMARK_MAPPING.put("07","直接借记无授权记录");
		ORG_RET_CD_REMARK_MAPPING.put("12","非对私活期帐号");
		ORG_RET_CD_REMARK_MAPPING.put("13","储蓄非个人结算账户不支持外部账户转帐");
		ORG_RET_CD_REMARK_MAPPING.put("14","商户审核不通过");
		ORG_RET_CD_REMARK_MAPPING.put("15","查开户方原因");
		ORG_RET_CD_REMARK_MAPPING.put("16","不允许持卡人进行的交易");
		ORG_RET_CD_REMARK_MAPPING.put("17","受卡方与安全保密部门联系");
		ORG_RET_CD_REMARK_MAPPING.put("18","超出交易次数限制");
		ORG_RET_CD_REMARK_MAPPING.put("19","账户被临时锁定");
		ORG_RET_CD_REMARK_MAPPING.put("20","日期切换正在处理");
		ORG_RET_CD_REMARK_MAPPING.put("21","交易金额小于最低限额");
		ORG_RET_CD_REMARK_MAPPING.put("22","未与银行签约");
		ORG_RET_CD_REMARK_MAPPING.put("99","其他原因");
	}
	/*end:批量代扣:扣款结果代码*/
	
	/*begin:批扣返回码映射，若没有，则默认采用99，把代收付回的原因写回去。updated by lizb on 2015-07-09*/
	//返回扣款结果代码
	public static String getKkjgdmByRetCd(String retCd) {
		if(StringUtils.isBlank(ORG_RET_CD_MAPPING.get(retCd))) {
			return "99";
		} 
		return ORG_RET_CD_MAPPING.get(retCd);
	}
	//返回扣款结果代码说明
	public static String getKkjgdmsmByRetCd(String retCd, String retCdRemark) {
		if("99".equals(getKkjgdmByRetCd(retCd))) {
			//直接回代收付的错误返回说明
			return retCdRemark;
		}
		return ORG_RET_CD_REMARK_MAPPING.get(getKkjgdmByRetCd(retCd));
	}
	/*end:批扣返回码映射，若没有，则默认采用99，把代收付回的原因写回去。updated by lizb on 2015-07-09*/
	// Constructors
	
	private boolean amountIsValidate;
	public boolean isAmountIsValidate() {
		return amountIsValidate;
	}

	public void setAmountIsValidate(boolean amountIsValidate) {
		this.amountIsValidate = amountIsValidate;
	}


	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/** default constructor */
	public UiPlds() {
	}

	/** minimal constructor */
	public UiPlds(String xh, String jfh, String jshmc, String kkyhdm,
			String kkzh, String kkzhmc, String bfjfbz, String zwlsh,
			String dfny, String bj, String wyj, String ykje, String fileId,
			String status, String createDate, String createTime) {
		super(xh, jfh, jshmc, kkyhdm, kkzh, kkzhmc, bfjfbz, zwlsh, dfny, bj,
				wyj, ykje, fileId,
				status, createDate,
				createTime);
	}

	/** full constructor */
	public UiPlds(String xh, String jfh, String jshmc, String kkyhdm,
			String kkzh, String kkzhmc, String bfjfbz, String zwlsh,
			String dfny, String bj, String wyj, String ykje, String kkjgdm,
			String skje, String yhsflsh, String kkrq, String kksj, String bz,
			String fileId, String outBank, String retCd, String retCdRemark,
			String workReturnNo, String status, String synFlag,
			String privateFlag, String createDate, String createTime,String txnDate) {
		super(xh, jfh, jshmc, kkyhdm, kkzh, kkzhmc, bfjfbz, zwlsh, dfny, bj,
				wyj, ykje, kkjgdm, skje, yhsflsh, kkrq, kksj, bz, fileId,
				retCd, retCdRemark, workReturnNo, status, privateFlag,
				createDate, createTime, txnDate);
	}
}
